<!--默认模板-->
<template>
  <div>
    <HeaderMo v-if="isMobile" />
    <HeaderPC v-else />
    <Nuxt keep-alive />
    <Footer v-if="!isMobile" />
    <!--全局loading-->
    <div class="pop-model" v-if="overLoading">
      <van-loading type="spinner" color="#fff" />
    </div>
    <toTop></toTop>
  </div>
</template>
<script>
import HeaderPC from "@/components/layouts/HeaderPC/HeaderPC.vue";
import HeaderMo from "@/components/layouts/HeaderMo/HeaderMo.vue";
import Footer from "@/components/layouts/Footer/Footer.vue";
import toTop from "@/components/basic/toTop.vue";
export default {
  components: {
    HeaderPC,
    HeaderMo,
    Footer,
    toTop,
  },
  computed: {
    isMobile() {
      return this.$store.state.isMobile;
    },
    overLoading() {
      return this.$store.state.overLoading;
    },
  },
  created() {
    this.$store.dispatch("menu/menuList", { parent_id: 1 }); //获取商品分类
  },
  mounted() {
    this.$store.commit("setLoding", false);
    this.getCountryList();
  },
  methods: {
    //获取国家列表
    getCountryList() {
      this.$store.dispatch("over/cotuntryList", {}).then((res) => {
        if (res.code == 0 && res.data != undefined) {
          localStorage.setItem("cotuntryList", JSON.stringify(res.data));
          this.$store.commit("over/setCountryList", res.data);
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.pop-model {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}
</style>
